<template>
  <div class="infoDetail-wrap">
    <div class="title-box">
      <div class="title">{{title}}</div>
      <div class="time">{{time | format}}</div>
    </div>
    <div class="content-box">{{content}}</div>
  </div>
</template>

<script>
  import {baseUrl} from "../../common/js/env"
  import {formatDate} from "../../common/js/util"

  export default {
    data() {
      return {
        title: "",
        content: "",
        time: "",
        infoId: ""
      }
    },
    mounted() {
      let base64 = require('js-base64').Base64;
      this.userSign = base64.decode(sessionStorage.getItem("user_sign"));
      this.$vux.loading.show({
        text: '加载中',
      });
      this.infoId = this.$route.query.id;
      this.axios.get(baseUrl + "/info/query_infodetail?sgin=" + this.userSign + "&infoId=" + this.infoId).then((res) => {
        let infoObj = res.data;
        this.$vux.loading.hide();
        if (infoObj.code == 0 && infoObj.data != null) {
          this.title = infoObj.data.informationTitle;
          this.content = infoObj.data.informationDetails;
          this.time = infoObj.data.time;
        } else {
          this.$vux.toast.text(infoObj.msg, "middle");
        }
      }).catch(() => {
        this.$vux.loading.hide();
        this.$vux.toast.text("网络异常", "middle");
      });
    },
    filters: {
      format(time) {
        let date = new Date(time);
        return formatDate(date, 'yyyy-MM-dd hh:mm:ss');
      },
    },
  }
</script>

<style lang="stylus" scoped>
  .infoDetail-wrap
    width: 100%
    height: 100%
    overflow: hidden
    .title-box
      display: flex
      flex-direction: column
      justify-content: center
      padding-left: 0.32rem
      margin-bottom: 0.427rem
      width: 100%
      height: 1.813rem
      border-bottom: 0.027rem solid #f2f2f2
      .title
        padding-bottom: 0.12rem
        font-size: 0.453rem
        color: rgba(29, 29, 29, 1)
      .time
        padding-top: 0.12rem
        font-size: 0.32rem
        color: rgba(153, 153, 153, 1)
    .content-box
      margin: 0 auto
      width: 92.53%
      height: auto
      font-size: 0.373rem
      color: rgba(102, 102, 102, 1)
      line-height: 0.56rem
      text-indent :0.72rem
</style>
